package cn.bsb.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.bsb.pojo.Comment;

public interface CommentMapper {
	
	@Select("SELECT *,(SELECT dev_user.user_code FROM dev_user WHERE dev_user.id=`comment`.dev_user_id) AS devCode FROM `comment`  WHERE article_id =#{aid} ORDER BY `TIME` DESC" )
	public List<Comment> getComment(@Param("aid") Long aid);
	
	@Insert("INSERT INTO `comment`(article_id,dev_user_id,connent,`time`) VALUES (#{articleId},#{devUserId},#{connent},#{time})")
	public int addComment(Comment comment);

}
